﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Book.aspx.cs" Inherits="NXBSaiGon.Book" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Label ID="Label_KetQuaGioHang" runat="server" Text=""></asp:Label>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:NXBSaiGonConnectionString1 %>" 
        DeleteCommand="DELETE FROM [Sach] WHERE [MaSach] = @MaSach" 
        InsertCommand="INSERT INTO [Sach] ([MaLoaiSach], [TenSach], [NgayXuatBan], [MoTa], [SoLuong], [DonGia], [ImageURL], [ChieuCao], [ChieuRong], [BeDay], [KhoiLuong], [NgayNhapKho]) VALUES (@MaLoaiSach, @TenSach, @NgayXuatBan, @MoTa, @SoLuong, @DonGia, @ImageURL, @ChieuCao, @ChieuRong, @BeDay, @KhoiLuong, @NgayNhapKho)" 
        ProviderName="<%$ ConnectionStrings:NXBSaiGonConnectionString1.ProviderName %>" 
        SelectCommand="SELECT [MaSach], [MaLoaiSach], [TenSach], [NgayXuatBan], [MoTa], [SoLuong], [DonGia], [ImageURL], [ChieuCao], [ChieuRong], [BeDay], [KhoiLuong], [NgayNhapKho] FROM [Sach]" 
        UpdateCommand="UPDATE [Sach] SET [MaLoaiSach] = @MaLoaiSach, [TenSach] = @TenSach, [NgayXuatBan] = @NgayXuatBan, [MoTa] = @MoTa, [SoLuong] = @SoLuong, [DonGia] = @DonGia, [ImageURL] = @ImageURL, [ChieuCao] = @ChieuCao, [ChieuRong] = @ChieuRong, [BeDay] = @BeDay, [KhoiLuong] = @KhoiLuong, [NgayNhapKho] = @NgayNhapKho WHERE [MaSach] = @MaSach">
        <DeleteParameters>
            <asp:Parameter Name="MaSach" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="MaLoaiSach" Type="Int32" />
            <asp:Parameter Name="TenSach" Type="String" />
            <asp:Parameter Name="NgayXuatBan" Type="DateTime" />
            <asp:Parameter Name="MoTa" Type="String" />
            <asp:Parameter Name="SoLuong" Type="Int32" />
            <asp:Parameter Name="DonGia" Type="Decimal" />
            <asp:Parameter Name="ImageURL" Type="String" />
            <asp:Parameter Name="ChieuCao" Type="Decimal" />
            <asp:Parameter Name="ChieuRong" Type="Decimal" />
            <asp:Parameter Name="BeDay" Type="Decimal" />
            <asp:Parameter Name="KhoiLuong" Type="Decimal" />
            <asp:Parameter Name="NgayNhapKho" Type="DateTime" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="MaLoaiSach" Type="Int32" />
            <asp:Parameter Name="TenSach" Type="String" />
            <asp:Parameter Name="NgayXuatBan" Type="DateTime" />
            <asp:Parameter Name="MoTa" Type="String" />
            <asp:Parameter Name="SoLuong" Type="Int32" />
            <asp:Parameter Name="DonGia" Type="Decimal" />
            <asp:Parameter Name="ImageURL" Type="String" />
            <asp:Parameter Name="ChieuCao" Type="Decimal" />
            <asp:Parameter Name="ChieuRong" Type="Decimal" />
            <asp:Parameter Name="BeDay" Type="Decimal" />
            <asp:Parameter Name="KhoiLuong" Type="Decimal" />
            <asp:Parameter Name="NgayNhapKho" Type="DateTime" />
            <asp:Parameter Name="MaSach" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>



    <asp:DataList ID="DataList1" runat="server" CellPadding="4" 
        DataKeyField="MaSach" DataSourceID="SqlDataSource1" ForeColor="#333333" 
        Width="917px" OnItemCommand="ProductsGrid_ItemCommand">
        <AlternatingItemStyle BackColor="White" />
        <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
        <ItemStyle BackColor="#E3EAEB" />
        
        
        <ItemTemplate>
       
            <div style="float:left">
                <a href="~/BookDetails.aspx?bookid=<%# Eval("MaSach") %>">
                    <asp:Image ID="img_product" runat="server" Width="132" Height="200" ImageUrl='<%# Eval("ImageURL") %>' ToolTip='<%# Eval("TenSach") %>' />
                </a>
            </div>
            <div style="float:left; padding-left:20px">
                <asp:Label ID="lbl_ten" runat="server" Text='<%# Eval("TenSach") %>' Font-Bold="true" Font-Size="Medium"/>
                <br />
                <asp:Label ID="bookdescription" runat="server" Text='<%# Eval("MoTa") %>' Font-Italic="true"/>
                <br />
                <br />
                Giá Sách :
                <asp:Label ID="lbl_gia" runat="server" Text='<%# Eval("DonGia") %>' Font-Bold="true" />
                <br />
                Ngày Xuất Bản :
                <asp:Label ID="NgayXuatBanLabel" runat="server" 
                    Text='<%# Eval("NgayXuatBan") %>'  Font-Bold="true" />
                <br />
                

                <asp:HiddenField ID="txtKLuong" runat="server" Value='<%# Eval("KhoiLuong") %>' />
                <asp:HiddenField ID="txtBDay" runat="server" Value='<%# Eval("BeDay") %>' />
                <asp:HiddenField ID="txtCCao" runat="server" Value='<%# Eval("ChieuCao") %>' />
                <asp:HiddenField ID="txtCRong" runat="server" Value='<%# Eval("ChieuRong") %>' />

                 
                <br />
                <br />
                <asp:LinkButton ID="LinkButton1" CommandName="datmua" CommandArgument='<%# Eval("MaSach") %>' runat="server">
                        Add to Cart</asp:LinkButton>

                
            </div>
            
        </ItemTemplate>
        <SelectedItemStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
    </asp:DataList>
      

    </asp:Content>
